<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="test1">1234</div>
<button onclick="playSound()" width='300px' height='200px'>点击调用</button>
</body>
<script>
    var msg=document.getElementById('test1');
        var u = navigator.userAgent;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    alert('是否是Android：'+isAndroid);
    alert('是否是iOS：'+isiOS);
    function playSound(){
          if(isiOS){
          window.webkit.messageHandlers.PlaySound.postMessage(msg);


          }else if(isAndroid){
                  myObj.fun1FromAndroid("调用android本地方法fun1FromAndroid(String name)！！");

          }
    }
</script>
</html>